<?php
namespace Home\Controller;
use Think\Controller;

class IndexController extends Controller
{
    public function index()
    {
        $nav = $this->nav();

        $this->assign("nav",$nav);
        $this->display();
    }

    //+-----------------------
    //|  导航
    //|  time: 2016-06-19 By One
    //+-----------------------

    public function nav()
    {	
    	//导航缓存  减少数据库压力
    	$n = S("nav_cache");
    	if(empty($n)){
    		  $n =M("nav")->select();
    		  S('nav_cache',$n,3600);
    	}

    	return $n;
    }
}
